package singleton;

//懒汉

public class LazySingleton {
    //对象并不进行初始化
    private static LazySingleton singleton;

    private LazySingleton(){};
    //没有synchronized修饰,并发不安全.
    public static LazySingleton getInstance(){
        if (singleton == null){
            singleton = new LazySingleton();
        }
        return singleton;
    }
}
